<template>
  <div>
    <el-affix :offset="0">
      <div class="box">
        <div class="Header-box">
          <div class="left-box">
            <div style="">
              <span style="color: #127cb4; font-size: 28px; font-weight: bold"
                >1900</span
              >
              <span style="color: #6b6969; font-size: 26px; font-weight: 600">
                电影网</span
              >
              <span style="color: #ce3e26; font-weight: 500; font-size: 26px"
                >. 大 片</span
              >
            </div>
          </div>
          <div class="search-home">
            <div class="search-box">
              <el-input v-model="searchMovie" clearable placeholder="搜索电影名称" />
            </div>
            <el-button type="primary" @click="search">搜索</el-button>
          </div>
          <div class="right-box">
            <div style="font-size: 12px">
              <!-- 判定user是否为真 为真则 -->
              <span v-if="user.account">
                欢迎您
                <a @click="$router.push('/person')"> {{ user.account }} </a> 
                <a href="/userLogin">退出</a>
              </span>
              <span v-else>
                您还未登录请先
                <a
                  style="color: blue; text-decoration: underline"
                  @click="$router.push('/userLogin')"
                  >登录</a
                >
              </span>

              <!-- <span style="font-size: 12px" @click="$router.push('/userLogin')"
                >登录注册</span
              > -->
            </div>
          </div>
        </div>
      </div>
    </el-affix>
  </div>
</template>

<script>
import request from '../../utils/request';
export default {
  name: "iviewHeader",
  props: ["user"], //存储登录的用户
  data() {
    return {
      searchMovie: "",
    };
  },
  methods: {
    search(){
      console.log("传出去的电影名称: " + this.searchMovie);
      //传输searchMovie名称
      this.$router.push({ path: "/search", query: { searchMovie:this.searchMovie } });
    }
  },
};
</script>

<style>
.box {
  min-width: 1000px;
  height: 66px;
  background-color: #869fd1;
}
.Header-box {
  height: 66px;
  width: 1000px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-home {
  display: flex;
  width: 350px;
  height: 50px;
  align-items: center;
}
.search-box {
  margin: 0 auto;
  display: flex;
  align-items: center;
  /* flex-direction: column;从左往右排序 */
}
.search-box input {
  font-size: 16px;
  /* padding      : 10px 20px; */
  width: 250px;
  height: 30px;
  /* background   : none; */
  /*边框厚度 颜色 显示*/
  border: 0px white none;
}
.search-box :hover {
  border: 1px rgb(208, 0, 96) solid;
}
.right-box {
  width: auto;
  flex-direction: column;
  margin-right: 5px;
}
</style>